<!DOCTYPE html>
<html lang="zh">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link href="https://cdn.bootcss.com/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
    <style type="text/css">
      @font-face {
        font-family: 'res';
        src: url('./font/1.ttf') format('truetype');
      }
      html,body{
        width: 100%;
        height: 100%;
        background: url(img/t.gif);
      }
      .info {
        color: #111;
        font-size: 22px;
        font-weight: 600;
        font-family: res, "microsoft yahei";
        line-height: 36px;
      }

      .tian {}
      .abtn{
        width: 100%;
        margin: 20px auto;
        text-align: center;
      }
      .row{
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }
      .container {
        background-color: #fff;
        box-sizing: border-box;
        padding: 60px 0;
        border: 1px solid #ccc;
        border-radius: 4px;
        box-shadow: 1px 2px 5px #ccc;
        margin-top: 40px;
      }
      .time{
        padding:  0px 20px;
      }
    </style>
    <title>舔狗日记</title>
  </head>
  <!-- https://v1.alapi.cn/api/dog?format=text -->
  <body>
    <div class="tit text-center">
      <h3>舔狗日记</h3>
    </div>
    
    <div class="container">
      <div class="time">
        2015-45-45 <span>晴</span>
      </div>
      <div class="row">
        <div class="col-xs-9 col-xs-offset-1 col-sm-7 col-sm-offset-3 col-lg-9 col-lg-offset-2">
          <div class="info">
            
          </div>
        </div>
      </div>
    </div>
    <div class="abtn">
      <button type="button" class="btn btn-primary tian">再来一条!</button>
    </div>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    <script type="text/javascript">
      $(function(){
        let time = new Date()
        console.log(time);
        let year = time.getFullYear()
        let month = time.getMonth()
        let day = time.getDate()
        $(".time").html(year+'-'+month+'-'+day+'<span> 晴</span>')
        $(".tian").click(go)
        go()
        function go(){
          $.ajax({
            url:'https://v1.alapi.cn/api/dog?format=text',
            type:'get',
            dataType:'text',
            success:function(e){
              $(".info").html(e)
            },
            error:function(e){
              console.log(e);
            }
          })
        }
      })
    </script>
  </body>
</html>
